<?php
/*
 * Created on 13.08.2008
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 defined( '_JEXEC' ) or die ( 'Restricted access' );
 require_once( JApplicationHelper::getPath( 'admin_html' ) );
 JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');
 switch($task) 
 {
 	case 'add';
 		editAmoquiz( $option );
 		break;
 		
 	case 'save';
 		saveAmoquiz( $option );
 		break;
 }
 function editAmoquiz( $option )
 {
	$row =& JTable::getInstance('Amoquiz_quiz', 'Table');
	$lists = Array();
	
	$lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $row->published);
	HTML_Amoquiz::editQuiz($row, $lists, $option);
 }
 function saveAmoquiz( $option )
 {
 	global $mainframe;
 	$row =& JTable::getInstance('amoquiz_quiz', 'Table');
 	if (!$row->bind(JRequest::get('post')))
 	{
 		die( 'Fehler1' );
 		//echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
 		exit();
 	}
 	$row->description = JRequest::getVar( 'description', '', 'post', 'string', JREQUEST_ALLOWRAW );
 	
 	if (!$row->store())
 	{
 		die( 'Fehler2' );
 		//echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
 		exit();
 	}
 	$mainframe->redirect('index.php?option=' . $option, 'Quiz Saved');
 }
?>
